#include <string.h>

#include "net_context.h"
#include "ip6_impl.h"

using namespace usnet;

std::unique_ptr<IP6Impl>
IP6Impl::MakeUnique(const PPT proto, EndpointAddr* laddr, EndpointAddr* raddr)
{
    auto ctx = NetContext::GetContext();
    std::unique_ptr<IP6Impl> ip6_impl { new(std::nothrow) IP6Impl { proto, laddr, raddr } };
    if (ip6_impl == nullptr) {
        LOG_ERROR(ctx, "failed to new IP6Impl instance");
        return nullptr;
    }
    if (ip6_impl->InitARPImpl() == false) {
        LOG_ERROR(ctx, "failed to init ARPImpl");
        return nullptr;
    }
    if (ip6_impl->InitEthImpl() ==  false) {
        LOG_ERROR(ctx, "failed to init EthImpl");
        return nullptr;
    }
    return ip6_impl;
}

std::shared_ptr<FrameBufMgr> IP6Impl::PrefillHeader()
{
    // pass
    return nullptr;
}

void IP6Impl::SendPacket()
{
    // pass
    return false;
}

bool IP6Impl::RecvPacket()
{
    // pass
    return false;
}